package com.base.demo.repository

import com.base.common.repository.BaseRemoteData
import com.base.demo.data.Login
import com.drake.net.Net
import dagger.hilt.android.scopes.ViewModelScoped
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import okhttp3.Headers
import kotlin.coroutines.CoroutineContext

@ViewModelScoped
class DemoRemote constructor( private val IO: CoroutineContext):BaseRemoteData(){


    fun  getData()= flow<Login> {

        var result= Net.get("http://192.168.60.36:3635/api/Login"){

            setHeaders(
                Headers.headersOf("LoginId","a002","password","Abcd12345678","Land","1")
            )
            param("DeviceType",1)
        }.execute<Login>()
        emit(result)

    }.flowOn(IO)




}